home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / VU Assist Modules for MacApp / Assist Module MA 3.0 / VUAssist Source Code / UVUAssist.p < prev   
Encoding:
Text File  |  1993-09-17  |  6.3 KB  |  192 lines  |  [TEXT/MPS ]

  1. (*+
  2.  *    File:        UVUAssist.p
  3.  *
  4.  *    Contains:    VU Assistance class - MacApp 3.0 compatible version
  5.  *
  6.  *    Written by:    David Shayer
  7.  *
  8.  *    Copyright:    © 1991-92 by Apple Computer, Inc., all rights reserved.
  9.  *
  10.  *  Version: 1.0a1
  11.  * 
  12.  *         2/13/92    JAS      indicate 3.0 compatibility, change version
  13.  *         1/27/92    JAS      make minor changes in USES clause for MA3.0b4 compatibility
  14.  *         10/4/91    JAS      change order of Balloons and UApplication in USES clause,
  15.  *                          indicate 3.0b2 compatibility, change version
  16.  *         9/10/91    JAS      indicate 3.0b2PQR compatibility, change version
  17.  *         8/21/91    JAS      change version
  18.  *         8/20/91    JAS      remove debugging code
  19.  *         8/19/91    JAS      rev comments and change case of GridItemSupport to 
  20.  *                          gridItemSupport
  21.  *         8/16/91    JAS      change interfaces for 3.0b2PQR
  22.  *         8/15/91    JAS      remove unneeded interfaces
  23.  *         8/15/91    JAS      add fGridItemSupport data member to TVUAssist and change
  24.  *                          prototype of IVUAssist to take GridItemSupport as input
  25.  *         8/13/91    JAS      include gridItem parameter in FillDlogItemDesc and RankToItem 
  26.  *         8/13/91    JAS      make TGridItem direct descendant of TObject instead of 
  27.  *                          TGridView
  28.  *         8/6/91        JAS      remove TVUAssist.DoFindWindowInfo (not needed) 
  29. -*)
  30.  
  31.  
  32. {Historical Note:  References to the "Mole" are equivalent to references to "Agent VU".
  33. "Agent VU" was previously called the "Mole".}
  34.  
  35. (*
  36.  
  37. So you wanna use V.U. to test your MacApp program?  You need to help Agent VU find things
  38. in your windows, since MacApp views appear empty to Agent VU.  Fortunately, Agent VU has a 
  39. hook for an assistance procedure.  The assistance procedure is a routine, in the application
  40. being manipulated by V.U., that feeds Agent VU inside information about what's in the
  41. views.  This unit implements that assistance routine.
  42.  
  43. This unit contains 4 files: VUAssist.p, VUAssist.inc1.p, VUAssist.inc2.p,
  44. and VUAssist.a.
  45.  
  46. See the "READ ME FIRST!" file for instructions on how to use VUAssist and other information.
  47.  
  48. *)
  49.  
  50.  
  51. UNIT UVUAssist;
  52.  
  53.     INTERFACE
  54.  
  55.         USES
  56.         
  57.             Types, MacAppTypes, Memory, UPascalObject, UObject, UList, AppleEvents, UEvent, 
  58.             UCommand, Dialogs, UEventHandler, UCommandHandler, Balloons, UApplication, UAdorners, 
  59.             UStream, UView, UWindow, UBehavior, UPrintHandler, UFailure, UGeometry, OSUtils, 
  60.             Menus, UMenuMgr, PrintTraps, UPrinting, UGridView, UTEView, UControl, UDialog, UPopup,
  61.     
  62.             { • System Interfaces }
  63.             Errors,
  64.             Resources,
  65.             AppleTalk, ToolUtils,
  66.             OSEvents,
  67.             Packages,
  68.             Devices,
  69.             Script;
  70.     
  71.     
  72.         {$I UVUAssist.inc1.p}
  73.  
  74.         TYPE
  75.  
  76.             TGridItem = OBJECT (TObject)
  77.                 
  78.                 fGridView:    TGridView;        { reference to a TGridView object}
  79.                     
  80.                 fColumn:    longint;        { 1 based counter }
  81.                 
  82.                 fRow:        longint;        { 1 based counter }
  83.                 
  84.                 fRank:        longint;        { (row-1) * rowlength + column }
  85.                 
  86.                 PROCEDURE TGridItem.IGridItem(theGridView: TGridView; Rank: integer);
  87.  
  88.                 PROCEDURE TGridItem.GetExtent(VAR itsExtent: VRect); 
  89.         
  90.                 PROCEDURE TGridItem.LocalToWindow(VAR thePoint: VPoint); 
  91.             
  92.                 END;
  93.  
  94.     
  95.             { There is a another definition of this object in UVUAssist.a, which is
  96.             a subset of this definition. If you update this definition, be sure to 
  97.             update the one in UVUAssist.a, if necessary. }
  98.             TVUAssist = OBJECT (TEventHandler)
  99.                 
  100.                 fMoleRefNum :integer;
  101.         
  102.                 fGridItemSupport :boolean;
  103.                 
  104.                 PROCEDURE TVUAssist.IVUAssist(gridItemSupport: boolean);
  105.         
  106.                 PROCEDURE TVUAssist.OpenMoleDriver;
  107.         
  108.                 PROCEDURE TVUAssist.SuspendMole;
  109.         
  110.                 PROCEDURE TVUAssist.ResumeMole; 
  111.         
  112.                 PROCEDURE TVUAssist.SetDebuggerHook (NewHook :ProcPtr); 
  113.         
  114.                 FUNCTION TVUAssist.MoleAssist (Select :integer; Input :Ptr; Output :Ptr; 
  115.                     VAR OutputSize :integer; IntResult :integer) :integer; 
  116.                 
  117.                 FUNCTION TVUAssist.DoMenuInfo (Input :Ptr; Output :Ptr; VAR OutputSize :integer; 
  118.                     Result :MoleError) :MoleError;
  119.         
  120.                 FUNCTION TVUAssist.DoMenuItems (Input :Ptr; Output :Ptr; VAR OutputSize :integer; 
  121.                     Result :MoleError) :MoleError;
  122.         
  123.                 FUNCTION TVUAssist.DoSendWindowInfo (Input :Ptr; Output :Ptr; 
  124.                     VAR OutputSize :integer; Result :MoleError) :MoleError;
  125.         
  126.                 FUNCTION TVUAssist.DoFindControl (Input :Ptr; Output :Ptr; 
  127.                     VAR OutputSize :integer; Result :MoleError) :MoleError;
  128.         
  129.                 FUNCTION TVUAssist.DoSendControlInfo (Input :Ptr; Output :Ptr; 
  130.                     VAR OutputSize :integer; Result :MoleError) :MoleError;
  131.         
  132.                 FUNCTION TVUAssist.DoSendDlogItemInfo (Input :Ptr; Output :Ptr; 
  133.                     VAR OutputSize :integer; Result :MoleError) :MoleError;
  134.         
  135.                 PROCEDURE TVUAssist.FillPopupDesc (Popup: TPopup; MenuRank: integer; 
  136.                     MenuDescPtr :MoleMenuInfoPtr; VAR OutputSize :integer);
  137.         
  138.                 FUNCTION TVUAssist.FillPopupItemDesc (Popup: TPopup; MenuRank: integer; 
  139.                     start: integer; stop: integer; MenuItemDescPtr :MoleDataBlockPtr; 
  140.                     VAR OutputSize :integer) :MoleError;
  141.         
  142.                 FUNCTION TVUAssist.FillCtrlDesc (CtrlDescPtr :MoleCDescPtr; thePart :integer; 
  143.                     WindRank :integer; ControlRank :integer; Control :TControl; 
  144.                     VAR OutputSize :integer): Boolean;
  145.         
  146.                 PROCEDURE TVUAssist.ViewRectToWindowRect (VAR aRect :Rect; aView :TView);
  147.         
  148.                 PROCEDURE TVUAssist.FillDlogItemDesc (DlogDescPtr :MoleDItemInfoPtr; 
  149.                     Window :TWindow; WindRank :integer; ItemRank :integer; Item :TView; 
  150.                     VAR OutputSize :integer; gridItem :TGridItem );
  151.         
  152.                 FUNCTION TVUAssist.RankToWindow (Rank :integer) :TWindow;
  153.                 
  154.                 FUNCTION TVUAssist.WindowToRank (WindToFind :WindowPeek) :integer;
  155.         
  156.                 PROCEDURE TVUAssist.GlobalToWindow (Window :TWindow; Pt :Point; VAR VPt :VPoint);
  157.         
  158.                 PROCEDURE TVUAssist.WindowToView (View :TView; VAR VPt :VPoint; VAR Pt :Point);
  159.         
  160.                 FUNCTION TVUAssist.MenuIDToPopup (MenuID :integer) :TPopup;
  161.         
  162.                 FUNCTION TVUAssist.PointToControl (Window :TWindow; Pt :Point; 
  163.                     VAR Rank :integer) :TCtlMgr;
  164.         
  165.                 FUNCTION TVUAssist.ItemToRank (Window :TWindow; View :TView; 
  166.                     DlogViewItems :Boolean) :integer;
  167.         
  168.                 FUNCTION TVUAssist.RankToItem (Window :TWindow; Rank :integer; 
  169.                     DlogViewItems :Boolean; VAR gridItem: TGridItem ) :TView;
  170.         
  171.                 FUNCTION TVUAssist.ViewCount (Window :TWindow; DlogViewItems :Boolean) :integer;
  172.         
  173.                 FUNCTION TVUAssist.CountGridItems (theGridView: TGridView): integer;
  174.         
  175.                 FUNCTION TVUAssist.GetItemType (Item :TView; DlogViewItems :Boolean;
  176.                     GridViewItems: Boolean) :ViewItems;
  177.         
  178.             
  179.             END;
  180.  
  181.             
  182.         VAR
  183.             gVUAssist :                    TVUAssist;        { the mole assist proc }
  184.  
  185.     
  186.     IMPLEMENTATION
  187.  
  188.         {$I UVUAssist.inc2.p}
  189.  
  190.  
  191. END.
  192.